#!/bin/bash
NAME=`echo ${1%%\.*} | sed -e "s/Immediate//g;s/Perfect//g;s/^results\/[a-zA-Z]\{2\}\([a-zA-Z]\)[a-zA-Z]*_\([a-z]\?\)[a-z]*\([0-9]\+\)x\([0-9]\+\)x\?\([0-9]\+\)_\([a-zA-Z]\)[a-zA-Z]*_\([0-9]\+\)[0-9]\{2\}keV_\([0-9]\+\|i\)\(so\|deg\)/e\1\2\3\4\5\6\7_\8/g"`
echo Starting job $NAME
PARAMS=""
if [ -n "`echo $1 | grep iso\..\.dat`" ]; then
	PARAMS=" --statistics "
else
	PARAMS=""
fi
./makehistograms_torque_script "$PARAMS" "$@" | qsub -q $(whoami) -m abe -l nodes=1,mem=150mb,nice=10 -N $NAME
